package cn.taskservice.common.exception;

import lombok.Getter;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 自定义聚合异常，将多个异常合并
 */
@Getter
public class ValidationException extends RuntimeException {
    private final List<Throwable> errors;

    public ValidationException(List<Throwable> errors) {
        super(errors.stream().map(Throwable::getMessage).collect(Collectors.joining("; ")));
        this.errors = errors;
    }
}
